> ## Documentation Index
> Fetch the complete documentation index at: https://edimez14-password_generator.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Saved Password

Deletes a saved password. Users can only delete their own passwords.

## Endpoint

```
DELETE /api/password-generator/view-all-saved-passwords/{pk}/delete/
```

## Authentication

**Authorization** `string` *required*

Bearer token for authentication. User must be logged in.

## Path Parameters

**pk** `integer` *required*

The unique identifier (primary key) of the saved password to delete.

## Request

This endpoint does not require a request body.

## Response

### Success Response

```json 204 No Content theme={null}
{
  "message": "Password deleted successfully"
}
```

### Error Responses

```json 404 Not Found theme={null}
{
  "error": "Password not found."
}
```

```json 500 Internal Server Error theme={null}
{
  "error": "error message"
}
```

## Authorization

Users can only delete passwords they own. The endpoint automatically filters by the authenticated user, ensuring users cannot delete other users' passwords.

If a user attempts to delete a password that:

* Does not exist, or
* Belongs to another user

The endpoint will return a 404 Not Found error.

## Example Request

```bash cURL theme={null}
curl -X DELETE https://api.example.com/api/password-generator/view-all-saved-passwords/1/delete/ \
  -H "Authorization: Bearer YOUR_TOKEN"
```

```javascript JavaScript theme={null}
fetch('https://api.example.com/api/password-generator/view-all-saved-passwords/1/delete/', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN'
  }
})
.then(response => {
  if (response.status === 204) {
    console.log('Password deleted successfully');
  }
});
```

```python Python theme={null}
import requests

headers = {
    'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.delete(
    'https://api.example.com/api/password-generator/view-all-saved-passwords/1/delete/',
    headers=headers
)

if response.status_code == 204:
    print('Password deleted successfully')
else:
    print(response.json())
```

## Implementation Details

This endpoint is implemented in `views.py:108` using the `delete_saved_password` view function. It retrieves the password instance filtered by both the primary key and the authenticated user, then deletes it from the database.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.